package com.cedifie.lendapp.utils.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import com.cedifie.lendapp.databinding.DialogSuccessBinding

/**
 * Cedifie
 * @Author wwdeng
 * @CreateTime: 2024/6/14 15:50
 * @Annotation：提示dialog
 */
class SuccessDialog: ProDialog {

    private lateinit var binding: DialogSuccessBinding
    private var mCallback: IDialogCallback? = null
    //事件备注
    private var eventRemark = ""

    constructor(context: Context?) : super(context) {}
    constructor(context: Context?, callback: IDialogCallback?) : super(context) {
        mCallback = callback
    }

    constructor(context: Context?, remark: String, callback: IDialogCallback?) : super(context) {
        mCallback = callback
        eventRemark = remark
    }

    /**
     * 设置点击回调
     */
    fun setOnClick(callback: IDialogCallback){
        this.mCallback = callback
    }

    override fun getRootView(): View {
        binding = DialogSuccessBinding.inflate(LayoutInflater.from(context))
        return binding.root
    }

    override fun initView() {
    }

    override fun initListener() {
    }

    override fun initData() {
    }

    override fun onViewClick(v: View?) {
        dismiss()
        if(mCallback != null){
            mCallback?.onClick(v)
        }
    }

    interface IDialogCallback {
        //按钮点击
        fun onClick(view: View?)
    }
}